<template>
	<view class="content">
		<div v-if="editFlag && model.checkStatus =='2'" style="width: 100%;
		padding:10rpx 0;
		font-size: 20rpx;
		line-height:45rpx;
		text-indent: 36rpx;
		border-bottom: 1px solid #ddd;">
			报名审核失败原因：<span style="color:red">{{model.idea}}</span>
		</div>
		<view style="width: 93%" v-show="statu == '1'">
			<uni-forms :border="true" :label-width="100">
				<uni-forms-item label="姓名" name="name">
					<uni-easyinput type="text" style="background-color: white" placeholder="请输入姓名" :inputBorder="false"
						v-model="model.realName" :disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="身份证号" name="name">
					<uni-easyinput type="text" placeholder="请输入身份证号码" :inputBorder="false" v-model="model.cardNo"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="手机号码" name="name">
					<uni-easyinput type="number" placeholder="请输入手机号码" :inputBorder="false" v-model="model.phone"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="通信地址" name="name">
					<uni-easyinput type="text" placeholder="请输入通信地址" :inputBorder="false" v-model="model.address"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="width: 93%" v-show="statu == '3'">
			<uni-forms :border="true" :label-width="100">
				<uni-forms-item label="家庭农场名称" name="name">
					<uni-easyinput type="text" placeholder="请输入家庭农场名称" v-model="model.companyName" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="负责人姓名" name="name">
					<uni-easyinput type="text" v-model="model.realName" placeholder="请输入负责人姓名" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="身份证号" name="name">
					<uni-easyinput type="text" v-model="model.cardNo" placeholder="请输入身份证号" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="手机号码" name="name">
					<uni-easyinput type="number" v-model="model.phone" placeholder="请输入手机号码" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="通信地址" name="name">
					<uni-easyinput type="text" v-model="model.address" placeholder="请输入通信地址" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="统一社会信用代码" name="name">
					<uni-easyinput type="text" v-model="model.creditCode" placeholder="请输入统一社会信用代码" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="注册资本(万)" name="name">
					<uni-easyinput type="number" v-model="model.registeredCapital" placeholder="请输入注册资本"
						:inputBorder="false" :disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="width: 93%" v-show="statu == '2'">
			<uni-forms :border="true" :label-width="100">
				<uni-forms-item label="合作社名称" name="name">
					<uni-easyinput type="text" placeholder="请输入合作社名称" v-model="model.companyName" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="法人代表" name="name">
					<uni-easyinput type="text" v-model="model.legalPerson" placeholder="请输入法人代表" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="身份证号" name="name">
					<uni-easyinput type="text" v-model="model.cardNo" placeholder="请输入身份证号" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="手机号码" name="name">
					<uni-easyinput type="number" v-model="model.phone" placeholder="请输入手机号码" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="通信地址" name="name">
					<uni-easyinput type="text" v-model="model.address" placeholder="请输入通信地址" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="统一社会信用代码" name="name">
					<uni-easyinput type="text" v-model="model.creditCode" placeholder="请输入统一社会信用代码" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="注册资本(万)" name="name">
					<uni-easyinput type="number" v-model="model.registeredCapital" placeholder="请输入注册资本"
						:inputBorder="false" :disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="width: 93%" v-show="statu == '4'">
			<uni-forms :border="true" :label-width="100">
				<uni-forms-item label="单位名称" name="name">
					<uni-easyinput type="text" placeholder="请输入单位名称" :inputBorder="false" v-model="model.companyName"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="法定代表人" name="name">
					<uni-easyinput type="text" v-model="model.legalPerson" placeholder="请输入 法定代表人姓名"
						:inputBorder="false" :disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="身份证号" name="name">
					<uni-easyinput type="text" v-model="model.cardNo" placeholder="请输入身份证号" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="手机号码" name="name">
					<uni-easyinput type="text" v-model="model.phone" placeholder="请输入手机号码" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="通信地址" name="name">
					<uni-easyinput type="text" v-model="model.address" placeholder="请输入通信地址" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="统一社会信用代码" name="name">
					<uni-easyinput type="text" v-model="model.creditCode" placeholder="请输入统一社会信用代码" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item label="注册资本(万)" name="name">
					<uni-easyinput type="number" v-model="model.registeredCapital" placeholder="请输入注册资本"
						:inputBorder="false" :disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="
        width: 100%;
        height: 20rpx;
        background-color: #d3d3d352;
        margin-bottom: 20rpx;
      "></view>
		<view style="width: 93%">
			<view style="
          width: 100%;
          font-size: 14px;
          color: #606266;
          height: 70rpx;
          display: flex;
          align-items: center;
        ">
				身份证附件
			</view>
			<view style="width: 100%; display: flex; justify-content: space-between">
				<upload_cropper title="点击上传身份证姓名页" @selectChange="zmUploadOk" :fileType="'1'" :disabled="disable"
					:obverseUrl="model.cardFilesPath[0]" @del="zmDel"></upload_cropper>
				<upload_cropper @selectChange="fmUploadOk" :fileType="'1'" :disabled="disable"
					:obverseUrl="model.cardFilesPath[1]" title="点击上传身份证国徽页" @del="fmDel"></upload_cropper>
			</view>
		</view>
		<view style="width: 93%">
			<uni-forms :border="true" :label-width="100">

				<uni-forms-item label="代打款" name="name">
					<view style="height: 100%; align-items: center; display: flex">
						<radio-group style="display: flex; align-items: center" @change="radioChange">
							<label style="display: flex; align-items: center">
								<view>
									<radio :checked="model.isTrustPay == 0" :disabled="disable"
										style="transform: scale(0.7)" :value="'0'" />
								</view>
								<view>否</view>
							</label>
							<label style="display: flex; align-items: center; margin-left: 20rpx">
								<view>
									<radio :checked="model.isTrustPay == 1" :disabled="disable"
										style="transform: scale(0.7)" :value="'1'" />
								</view>
								<view>是</view>
							</label>
						</radio-group>
					</view>
				</uni-forms-item>
				<uni-forms-item label="打款人开户行" name="name">
					<uni-easyinput type="text" placeholder="请输入打款人开户行" v-model="model.bankName" :inputBorder="false"
						placeholderStyle="background-color:white" :disabled="disable" />
				</uni-forms-item>
				<uni-forms-item label="打款人账号" name="name">
					<uni-easyinput type="text" placeholder="请输入打款人账号" v-model="model.bankNumber" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>

				<uni-forms-item label="代打款人" name="name" v-if="model.isTrustPay == 1">
					<uni-easyinput type="text" placeholder="请输入代打款人" v-model="model.trustPayer" :inputBorder="false"
						:disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>

				<uni-forms-item :label-width="120" label="代打款人手机号" name="name" v-if="model.isTrustPay == 1">
					<uni-easyinput type="text" placeholder="请输入代打款人手机号" v-model="model.trustPayerPhone"
						:inputBorder="false" :disabled="disable" placeholderStyle="background-color:white" />
				</uni-forms-item>
				<uni-forms-item :label-width="240" label="代打款人身份证" name="name" v-if="model.isTrustPay == 1">

				</uni-forms-item>
				<view style="width: 100%; display: flex; justify-content: space-between" v-if="model.isTrustPay == 1">
					<upload_cropper title="点击上传身份证姓名页" @selectChange="dzmUploadOk" :fileType="'5'" :disabled="disable"
						:obverseUrl="model.dcardFilesPath[0]" @del="dzmDel"></upload_cropper>
					<upload_cropper @selectChange="dfmUploadOk" :fileType="'5'" :disabled="disable"
						:obverseUrl="model.dcardFilesPath[1]" title="点击上传身份证国徽页" @del="dfmDel"></upload_cropper>
				</view>
			</uni-forms>
		</view>
		<view style="width: 93%" v-if="statu != '4'">
			<uni-forms label-position="top" :label-width="140">
				<uni-forms-item label="银行卡附件" name="name">
					<upload_cropper @selectChange="yhkUploadOk" :disabled="disable" :obverseUrl="model.bankFilePath"
						:fileType="'2'" title="点击上传银行卡正面照片" @del="yhkDel"></upload_cropper>
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="width: 93%" v-if="statu == '4'">
			<uni-forms label-position="top" :label-width="140">
				<uni-forms-item label="基本存款账户信息附件" name="name">
					<upload_cropper @selectChange="yhkUploadOk" :disabled="disable" :obverseUrl="model.bankFilePath"
						:fileType="'2'" title="点击上传基本存款账户信息照片" @del="yhkDel"></upload_cropper>
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="width: 93%">
			<uni-forms label-position="top" :label-width="140">
				<uni-forms-item label="打款证明" name="name">
					<Rboy-upload-sfz  @selectChange="dkzmUploadOk" :disabled="disable" :obverseUrl="model.payFilePath"
						:fileType="'4'" title="点击上传打款证明" @del="dkzmDel"></Rboy-upload-sfz>
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="        width: 100%;
        height: 20rpx;
        background-color: #d3d3d352;
        margin-bottom: 20rpx;
      ">


		</view>
		<view style="width: 93%" v-if="projectType != '6' && projectType != '12' && projectType != '13'">
			<uni-forms label-position="top" :label-width="100">
				<uni-forms-item label="附件上传" name="name">
					<cl-upload :fileType="'image'" @uploadOk="onSuccess" @del="delFj" :add="!disable" :remove="!disable"
						v-model="model.otherFilesPath" :max="4" :autoUpload="false"></cl-upload>
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="width: 93%" v-if="projectType == '6' || projectType == '12' || projectType == '13'">
			<uni-forms label-position="top" :label-width="240">
				<uni-forms-item label="附件（营业执照、施工资质等）" name="name">
					<cl-upload :fileType="'image'" @uploadOk="onSuccess" @del="delFj" :add="!disable" :remove="!disable"
						v-model="model.otherFilesPath" :max="4" :autoUpload="false"></cl-upload>
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="
        width: 100%;
        height: 20rpx;
        background-color: #d3d3d352;
        margin-top: -20rpx;
        margin-bottom: 20rpx;
      "></view>
		<view style="width: 93%" v-if="!disable">
			<uni-forms :label-width="100">
				<uni-forms-item label="审批人" name="name">
					<view style="
              height: 100%;
              width: 100%;
              color: #00000060;
              font-size: 14px;
              display: flex;
              align-items: center;
            " @click="checkShenPi">{{
              model.checkUser_dict ? model.checkUser_dict : "请选择审批人"
            }}</view>
					<!-- <uni-easyinput
            type="text"
            v-model="model.checkUser_dict"
            :inputBorder="false"
            placeholder="请选择审批人"
            @focus="checkShenPi"
            :disabled="disable"
            placeholderStyle="background-color:white"
          /> -->
				</uni-forms-item>
			</uni-forms>
		</view>
		<view style="
        width: 93%;
        display: flex;
        flex-direction: column;
        align-items: center;
      " v-if="!disable">
			<checkbox-group style="display: flex; flex-direction: column; width: 100%" @change="changeCN">
				<label>
					<checkbox value="1" style="transform: scale(0.7)" />
					<text style="font-size: 13px">同意</text>
					<text style="margin-left: 20rpx; color: #136bffff; font-size: 13px"
						@click="hetong(1)">《网络竞价项目报名承诺函》</text>
				</label>
				<label>
					<checkbox value="2" style="transform: scale(0.7); margin-top: 20rpx" />
					<text style="font-size: 13px">同意</text>
					<text style="margin-left: 20rpx; color: #136bffff; font-size: 13px"
						@click="hetong(2)">《网络竞价须知》</text>
				</label>
				<label v-show="statu == 1">
					<checkbox value="3" style="transform: scale(0.7); margin-top: 20rpx" />
					<text style="font-size: 13px">同意</text>
					<text style="margin-left: 20rpx; color: #136bffff; font-size: 13px"
						@click="hetong(3)">《临沂市产权合同》</text>
				</label>
			</checkbox-group>
			<button v-if="!editFlag" style="
          background-color: #136bffff;
          color: white;
          width: 98%;
          margin-top: 40rpx;
        " @click="baoming">
				立即报名
			</button>
			<button v-if="editFlag" style="
	      background-color: #136bffff;
	      color: white;
	      width: 98%;
	      margin-top: 40rpx;
	    " @click="baomingedit">
				提交报名
			</button>
			<view style="height: 200rpx"></view>
		</view>
		<h-select :list="userList" :subscript="'nickname'" ref="checkUser" @change="shenpi"></h-select>
		
	 
	</view>
</template>

<script>
	import file from "@/components/Rboy-upload-sfz/file.js";
	import upload_cropper from "@/components/upload-cropper-h5/upload-cropper-h5";
	import {
		electBidding,
		mineProject,
		api
	} from "@/utils/api.js";
	export default {
		components: {
			upload_cropper
		},
		data() {
			return {
				statu: "1",
				del: file.del,
				reverse: file.yinhangka,
				disable: false,
				editFlag: false,
				data: {},
				projectType: '',
				model: {
					cardFilesPath: ["", ""],
					dcardFilesPath: ["", ""],
					cardFiles: ["", ""],
					dcardFiles: ["", ""],
					bankFilePath: "",
					bankFile: {},
					payFilePath: "",
					payFile: {},
					otherFilesPath: [],
					otherFiles: [],
					isTrustPay: 0,
				},
				userList: [],
				sfz: ["", ""],
				chengnuo: [],
				baseUrl: this.$baseUrl,
				imageValue: [],
				idea: ''
			};
		},
		onLoad(e) {
			console.log('e', e)
			if (e.dis == 1) { ///回显状态，可编辑editFlag
				this.disable = false;
				this.editFlag = true;

				this.getUserList(e.Id);
				this.getDetail(JSON.parse(e.data));

			} else { ///表单填写状态
				this.statu = e.data;
				this.model.userType = e.data;
				let data = JSON.parse(e.val);
				//console.log('data.dataType', data.dataType)
				this.model.projectId = data.id;
				this.data = data;
				this.projectType = data.dataType
				//console.log(data);
				this.getUserList(data.id);
				if (this.pastDue()) {
					uni.showToast({
						title: "报名时间已过期",
						duration: 2000,
						icon: "none",
					});
					return;
				}
			}
		},
		methods: {
			async select(e) {
				for (let i = 0; i < e.tempFilePaths.length; i++) {
					let ress = await api.upload({
						url: e.tempFilePaths[i],
						data: {
							fileType: 3
						},
					});
					this.model.otherFilesPath.push(e.tempFilePaths[i]);
					this.model.otherFiles.push(ress.data.fileId);
				}
			},
			progress() {
				//console.log("progress");
			},
			fail() {
				//	console.log("fail");
			},
			success() {
				//	console.log("success");
			},
			pastDue() {
				const nowDate = new Date();
				const pastDate = new Date(this.data.enrollEndTime);
				if (nowDate > pastDate) {
					return true;
				} else {
					return false;
				}
			},
			async getDetail(e) {
				let res = await mineProject.getProjectUserInfoDetail(e);
				console.log('回显详情', res);
				this.model = res.data.main;
				this.statu = res.data.main.userType;
				this.projectType = res.data.main.projectType;
				
				if (res.data.yhkfiles && res.data.yhkfiles.length) {
					this.model.bankFilePath = this.baseUrl + res.data.yhkfiles[0].filePath;
				}else{
					this.model.bankFilePath = ''
				}
				
				if (res.data.yhkfiles && res.data.yhkfiles.length) {
					this.model.bankFile = res.data.yhkfiles[0].id;
				}else{
					this.model.bankFile = {}
				}
				
				if (res.data.sfzfiles && res.data.sfzfiles.length) {
					this.model.cardFilesPath = [
						this.baseUrl + res.data.sfzfiles[0].filePath,
						this.baseUrl + res.data.sfzfiles[1].filePath,
					]
				}else{
					this.model.cardFilesPath = ["", ""]
				}
				
				if (res.data.sfzfiles && res.data.sfzfiles.length) {
					this.model.cardFiles = [
						res.data.sfzfiles[0].id,
						res.data.sfzfiles[1].id,
					]
				}else{
					this.model.cardFiles = ['', '']
				}


				if (res.data.dsfzfiles && res.data.dsfzfiles.length) {
					this.model.dcardFilesPath = [
						this.baseUrl + res.data.dsfzfiles[0].filePath,
						this.baseUrl + res.data.dsfzfiles[1].filePath,
					]
				} else {
					this.model.dcardFilesPath = ["",""];
					
				}
				
				if (res.data.dsfzfiles && res.data.dsfzfiles.length) {
			
					this.model.dcardFiles = [
						res.data.dsfzfiles[0].id,
						res.data.dsfzfiles[1].id,
					]
				} else {
					this.model.dcardFiles = ['', ''];
				}
				if (res.data.payfiles.length) {
					this.model.payFile = res.data.payfiles[0].id;
					this.model.payFilePath = this.baseUrl + res.data.payfiles[0].filePath;
				} else {
					this.model.payFile = ''
				}
				if (res.data.qtfiles.length) {
					let arr = [];
					this.model.otherFiles = [];
					this.model.otherFilesPath = [];
					for (let index = 0; index < res.data.qtfiles.length; index++) {
						// arr.push(this.baseUrl + res.data.qtfiles[index].filePath);
						const nameArr = res.data.qtfiles[index].filePath.split("/");
						const extArr = res.data.qtfiles[index].filePath.split(".");
						this.model.otherFilesPath.push({
							name: nameArr[nameArr.length - 1],
							extname: extArr[extArr.length - 1],
							url: this.baseUrl + res.data.qtfiles[index].filePath,
						});

						// otherFilesPath
						this.model.otherFiles.push(res.data.qtfiles[index].id);
					}

				} else {
					this.model.otherFiles = []
				}

				// this.model.otherFilesPath = arr;
			},

			//////获取审核人列表
			async getUserList(e) {
				let res = await electBidding.getUserList({
					projectId: e
				});
				//console.log(res);
				this.userList = res.data;
			},
			shenpi(e) {
				//	console.log(e);
				this.model.checkUserId = e.id;
				this.model.checkUser_dict = e.nickname;
				this.$forceUpdate();
			},
			checkShenPi() {
				this.$refs.checkUser.open();
			},
			zmUploadOk(e) {
				console.log('第一次上传正面',e);
				this.model.cardFilesPath[0] = e.tempFilePath;
				this.model.cardFiles[0] = e.fileId;
				this.$forceUpdate();
			},
			dzmUploadOk(e) {
				console.log('第二次上传',e);
				this.model.dcardFilesPath[0] = e.tempFilePath;
				this.model.dcardFiles[0] = e.fileId;
				this.$forceUpdate();
			},
			zmDel() {
				this.model.cardFilesPath[0] = "";
				this.model.cardFiles[0] = "";
				this.$forceUpdate();
			},
			dzmDel() {
				this.model.dcardFilesPath[0] = "";
				this.model.dcardFiles[0] = "";
				this.$forceUpdate();
			},
			dfmUploadOk(e) {
				this.model.dcardFilesPath[1] = e.tempFilePath;
				this.model.dcardFiles[1] = e.fileId;
				this.$forceUpdate();
			},
			fmUploadOk(e) {
				console.log('第一次上传反面',e);
				this.model.cardFilesPath[1] = e.tempFilePath;
				this.model.cardFiles[1] = e.fileId;
				this.$forceUpdate();
			},
			dfmDel() {
				this.model.dcardFilesPath[1] = "";
				this.model.dcardFiles[1] = "";
				this.$forceUpdate();
			},
			fmDel() {
				this.model.cardFilesPath[1] = "";
				this.model.cardFiles[1] = "";
				this.$forceUpdate();
			},
			yhkUploadOk(e) {
				console.log(e);
				this.model.bankFilePath = e.tempFilePath;
				this.model.bankFile = e.fileId;
				this.$forceUpdate();
			},
			yhkDel() {
				this.model.bankFilePath = "";
				this.model.bankFile = "";
				this.$forceUpdate();
			},
			dkzmUploadOk(e) {
				console.log(e);
				this.model.payFilePath = e.tempFilePath;
				this.model.payFile = e.fileId;
				this.$forceUpdate();
			},
			dkzmDel() {
				this.model.payFilePath = "";
				this.model.payFile = "";
				this.$forceUpdate();
			},
			onSuccess(e) {
				this.model.otherFilesPath = [
					...this.model.otherFilesPath,
					...e.tempFilePaths,
				];
				this.model.otherFiles = [...this.model.otherFiles, ...e.tempFiles];
				this.$forceUpdate();
			},
			delFj(e) {
				//	console.log(e);
				this.model.otherFilesPath.splice(e, 1);
				this.model.otherFiles.splice(e, 1);
				this.$forceUpdate();
			},
			/////初次报名
			async baoming() {
				if (this.pastDue()) {
					uni.showToast({
						title: "报名时间已过期",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				let data = this.model;
				if (this.statu == "1") {
					if (!data.realName) {
						uni.showToast({
							title: "请输入姓名",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.cardNo) {
						uni.showToast({
							title: "请输入身份证号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (data.cardNo.length != 18) {
							//身份证长度不对

							uni.showToast({
								title: "身份证号长度不正确",
								duration: 2000,
								icon: "none",
							});
							return;
						}
					}
					if (!data.phone) {
						uni.showToast({
							title: "请输入手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (!/^1[3456789]\d{9}$/.test(data.phone)) {
							uni.showToast({
								title: "手机号格式错误",
								duration: 2000,
								icon: "none",
							});
							//手机号不合法
							return;
						}
					}
					if (!data.address) {
						uni.showToast({
							title: "请输入通信地址",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				} else if (this.statu == "2") {
					//合作社
					if (!data.companyName) {
						uni.showToast({
							title: "请输入合作社名称",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.legalPerson) {
						uni.showToast({
							title: "请输入法人代表",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.cardNo) {
						uni.showToast({
							title: "请输入身份证号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (data.cardNo.length != 18) {
							uni.showToast({
								title: "身份证号长度不正确",
								duration: 2000,
								icon: "none",
							});
							//身份证长度不对
							return;
						}
					}
					if (!data.phone) {
						uni.showToast({
							title: "请输入手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (!/^1[3456789]\d{9}$/.test(data.phone)) {
							uni.showToast({
								title: "手机号格式不正确",
								duration: 2000,
								icon: "none",
							});
							//手机号不合法
							return;
						}
					}
					if (!data.address) {
						uni.showToast({
							title: "请输入通讯地址",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.creditCode) {
						uni.showToast({
							title: "请输入统一社会信用代码",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.registeredCapital) {
						uni.showToast({
							title: "请输入注册资本",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				} else if (this.statu == "3") {
					if (!data.companyName) {
						uni.showToast({
							title: "请输入农场名称",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.realName) {
						uni.showToast({
							title: "请输入负责人姓名",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.cardNo) {
						uni.showToast({
							title: "请输入身份证号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (data.cardNo.length != 18) {
							uni.showToast({
								title: "身份证号长度不正确",
								duration: 2000,
								icon: "none",
							});
							//身份证长度不对
							return;
						}
					}
					if (!data.phone) {
						uni.showToast({
							title: "请输入手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (!/^1[3456789]\d{9}$/.test(data.phone)) {
							uni.showToast({
								title: "手机号格式不正确",
								duration: 2000,
								icon: "none",
							});
							//手机号不合法
							return;
						}
					}
					if (!data.address) {
						uni.showToast({
							title: "请输入通信地址",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.creditCode) {
						uni.showToast({
							title: "请输入统一社会信用代码",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.registeredCapital) {
						uni.showToast({
							title: "请输入请输入注册资本",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				} else {
					if (!data.companyName) {
						uni.showToast({
							title: "请输入单位名称",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.legalPerson) {
						uni.showToast({
							title: "请输入法定代表人",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.cardNo) {
						uni.showToast({
							title: "请输入身份证号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (data.cardNo.length != 18) {
							uni.showToast({
								title: "身份证号长度不正确",
								duration: 2000,
								icon: "none",
							});
							//身份证长度不对
							return;
						}
					}
					if (!data.phone) {
						uni.showToast({
							title: "请输入手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (!/^1[3456789]\d{9}$/.test(data.phone)) {
							uni.showToast({
								title: "手机号格式不正确",
								duration: 2000,
								icon: "none",
							});
							//手机号不合法
							return;
						}
					}
					if (!data.address) {
						uni.showToast({
							title: "手机号格式不正确",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.creditCode) {
						uni.showToast({
							title: "请输入统一社会信用代码",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.registeredCapital) {
						uni.showToast({
							title: "请输入注册资本",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				}
				if (data.cardFilesPath[0] == "") {
					uni.showToast({
						title: "请上传身份证姓名页",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (data.cardFilesPath[1] == "") {
					uni.showToast({
						title: "请上传身份证国徽页",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (!data.bankName) {
					uni.showToast({
						title: "请输入打款人开户行",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (data.isTrustPay == 1) {
					if (!data.trustPayer) {
						uni.showToast({
							title: "请输入代打款人",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.trustPayerPhone) {
						uni.showToast({
							title: "请输入代打款人手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (data.dcardFilesPath[0] == "") {
						uni.showToast({
							title: "请上传代打款人身份证姓名页",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (data.dcardFilesPath[1] == "") {
						uni.showToast({
							title: "请上传代打款人身份证国徽页",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				}
				if (!data.bankNumber) {
					uni.showToast({
						title: "请输入打款人账号",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (data.bankFilePath == "") {
					uni.showToast({
						title: "请上传银行卡正面照",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (!data.checkUserId) {
					uni.showToast({
						title: "请选择审核人",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (this.chengnuo.indexOf("1") == -1) {
					uni.showToast({
						title: "请同意报名承诺函",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (this.chengnuo.indexOf("2") == -1) {
					uni.showToast({
						title: "请同意网络竞价须知",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (this.statu == 1) {
					if (this.chengnuo.indexOf("3") == -1) {
						uni.showToast({
							title: "请同意临沂市产权合同",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				}
				
				let files = [...data.cardFiles, ...data.dcardFiles, data.bankFile, ...this.model.otherFiles, data.payFile];
				 console.log('files',files);
				
				let val = {};
				val.fileIdList = files;
				val.projectId = data.projectId;
				val.userType = data.userType;
				val.realName = data.realName;
				val.realNxame = data.realNxame;
				val.legalPerson = data.legalPerson;
				val.companyName = data.companyName;
				val.cardNo = data.cardNo;
				val.phone = data.phone;
				val.address = data.address;
				val.creditCode = data.creditCode;
				val.bankNumber = data.bankNumber;
				val.trustPayer = data.trustPayer;
				val.trustPayerPhone = data.trustPayerPhone;
				val.bankName = data.bankName;
				val.isTrustPay = data.isTrustPay;
				val.checkUserId = data.checkUserId;
				val.registeredCapital = data.registeredCapital;
				console.log('val',val)
				let res = await electBidding.projectReport(val);
				uni.showToast({
					title: res.message,
					duration: 2000,
					icon: "none",
				});
				if(res.code == 1000){
					setTimeout(() => {
						uni.navigateBack({
							delta: 2,
						});
					}, 2000);
				}
			},
			////编辑报名
			async baomingedit() {
				if (this.pastDue()) {
					uni.showToast({
						title: "报名时间已过期",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				let data = this.model;
				if (this.statu == "1") {
					if (!data.realName) {
						uni.showToast({
							title: "请输入姓名",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.cardNo) {
						uni.showToast({
							title: "请输入身份证号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (data.cardNo.length != 18) {
							//身份证长度不对

							uni.showToast({
								title: "身份证号长度不正确",
								duration: 2000,
								icon: "none",
							});
							return;
						}
					}
					if (!data.phone) {
						uni.showToast({
							title: "请输入手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (!/^1[3456789]\d{9}$/.test(data.phone)) {
							uni.showToast({
								title: "手机号格式错误",
								duration: 2000,
								icon: "none",
							});
							//手机号不合法
							return;
						}
					}
					if (!data.address) {
						uni.showToast({
							title: "请输入通信地址",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				} else if (this.statu == "2") {
					//合作社
					if (!data.companyName) {
						uni.showToast({
							title: "请输入合作社名称",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.legalPerson) {
						uni.showToast({
							title: "请输入法人代表",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.cardNo) {
						uni.showToast({
							title: "请输入身份证号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (data.cardNo.length != 18) {
							uni.showToast({
								title: "身份证号长度不正确",
								duration: 2000,
								icon: "none",
							});
							//身份证长度不对
							return;
						}
					}
					if (!data.phone) {
						uni.showToast({
							title: "请输入手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (!/^1[3456789]\d{9}$/.test(data.phone)) {
							uni.showToast({
								title: "手机号格式不正确",
								duration: 2000,
								icon: "none",
							});
							//手机号不合法
							return;
						}
					}
					if (!data.address) {
						uni.showToast({
							title: "请输入通讯地址",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.creditCode) {
						uni.showToast({
							title: "请输入统一社会信用代码",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.registeredCapital) {
						uni.showToast({
							title: "请输入注册资本",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				} else if (this.statu == "3") {
					if (!data.companyName) {
						uni.showToast({
							title: "请输入农场名称",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.realName) {
						uni.showToast({
							title: "请输入负责人姓名",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.cardNo) {
						uni.showToast({
							title: "请输入身份证号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (data.cardNo.length != 18) {
							uni.showToast({
								title: "身份证号长度不正确",
								duration: 2000,
								icon: "none",
							});
							//身份证长度不对
							return;
						}
					}
					if (!data.phone) {
						uni.showToast({
							title: "请输入手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (!/^1[3456789]\d{9}$/.test(data.phone)) {
							uni.showToast({
								title: "手机号格式不正确",
								duration: 2000,
								icon: "none",
							});
							//手机号不合法
							return;
						}
					}
					if (!data.address) {
						uni.showToast({
							title: "请输入通信地址",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.creditCode) {
						uni.showToast({
							title: "请输入统一社会信用代码",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.registeredCapital) {
						uni.showToast({
							title: "请输入请输入注册资本",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				} else {
					if (!data.companyName) {
						uni.showToast({
							title: "请输入单位名称",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.legalPerson) {
						uni.showToast({
							title: "请输入法定代表人",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.cardNo) {
						uni.showToast({
							title: "请输入身份证号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (data.cardNo.length != 18) {
							uni.showToast({
								title: "身份证号长度不正确",
								duration: 2000,
								icon: "none",
							});
							//身份证长度不对
							return;
						}
					}
					if (!data.phone) {
						uni.showToast({
							title: "请输入手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					} else {
						if (!/^1[3456789]\d{9}$/.test(data.phone)) {
							uni.showToast({
								title: "手机号格式不正确",
								duration: 2000,
								icon: "none",
							});
							//手机号不合法
							return;
						}
					}
					if (!data.address) {
						uni.showToast({
							title: "手机号格式不正确",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.creditCode) {
						uni.showToast({
							title: "请输入统一社会信用代码",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.registeredCapital) {
						uni.showToast({
							title: "请输入注册资本",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				}
				if (data.cardFilesPath[0] == "") {
					uni.showToast({
						title: "请上传身份证姓名页",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (data.cardFilesPath[1] == "") {
					uni.showToast({
						title: "请上传身份证国徽页",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (!data.bankName) {
					uni.showToast({
						title: "请输入打款人开户行",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (data.isTrustPay == 1) {
					if (!data.trustPayer) {
						uni.showToast({
							title: "请输入代打款人",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (!data.trustPayerPhone) {
						uni.showToast({
							title: "请输入代打款人手机号",
							duration: 2000,
							icon: "none",
						});
						return;
					}

					if (data.dcardFilesPath[0] == "") {
						uni.showToast({
							title: "请上传代打款人身份证姓名页",
							duration: 2000,
							icon: "none",
						});
						return;
					}
					if (data.dcardFilesPath[1] == "") {
						uni.showToast({
							title: "请上传代打款人身份证国徽页",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				}
				if (!data.bankNumber) {
					uni.showToast({
						title: "请输入打款人账号",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (data.bankFilePath == "") {
					uni.showToast({
						title: "请上传银行卡正面照",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (!data.checkUserId) {
					uni.showToast({
						title: "请选择审核人",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (this.chengnuo.indexOf("1") == -1) {
					uni.showToast({
						title: "请同意报名承诺函",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (this.chengnuo.indexOf("2") == -1) {
					uni.showToast({
						title: "请同意网络竞价须知",
						duration: 2000,
						icon: "none",
					});
					return;
				}
				if (this.statu == 1) {
					if (this.chengnuo.indexOf("3") == -1) {
						uni.showToast({
							title: "请同意临沂市产权合同",
							duration: 2000,
							icon: "none",
						});
						return;
					}
				}
				// console.log('data.cardFiles', data.cardFiles);
				// console.log('data.dcardFiles', data.dcardFiles);
				// console.log('data.bankFile', data.bankFile);
				// console.log('dataFiles', data.otherFiles);
				// console.log('payFile', data.payFile);
				let files = [...data.cardFiles, ...data.dcardFiles, data.bankFile, ...this.model.otherFiles, data.payFile];
				//console.log('待上传之前所有的files',files);
	
				let val = {};
				val.fileIdList = files;
				val.id = data.id;
				val.projectId = data.projectId;
				val.userType = data.userType;
				val.realName = data.realName;
				val.realNxame = data.realNxame;
				val.legalPerson = data.legalPerson;
				val.companyName = data.companyName;
				val.cardNo = data.cardNo;
				val.phone = data.phone;
				val.address = data.address;
				val.creditCode = data.creditCode;
				val.bankNumber = data.bankNumber;
				val.trustPayer = data.trustPayer;
				val.trustPayerPhone = data.trustPayerPhone;
				val.bankName = data.bankName;
				val.isTrustPay = data.isTrustPay;
				val.checkUserId = data.checkUserId;
				val.registeredCapital = data.registeredCapital;
				//console.log('待上传之前所有的val',val);
			
				let res = await electBidding.projectReportAgain(val);
				uni.showToast({
					title: res.message,
					duration: 2000,
					icon: "none",
				});
				if(res.code == 1000){
					setTimeout(() => {
						uni.navigateBack({
							delta: 2,
						});
					}, 2000);
				}
			},
			radioChange(e) {
				//	console.log(e);
				this.model.isTrustPay = e.target.value;
			},
			changeCN(e) {
				//	console.log(e);
				this.chengnuo = e.detail.value;
			},
			hetong(e) {
				uni.navigateTo({
					url: "/pages/electBidding/contract?type=" +
						e +
						"&projectId=" +
						this.data.dataId,
				});
			},
		},
	};
</script>

<style scoped lang="less">
	@imgWidth: 345rpx;
	@imgheight: 220rpx;
	@boxheight: 280rpx;

	.content {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-top: 20rpx;
	}

	.Rboy-reverse {
		border-radius: 10rpx;
		width: @imgWidth;
		height: @boxheight;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		position: relative;

		.reverseimg {
			width: @imgWidth;
			height: @imgheight;
		}

		.bottom {
			text-align: center;
			height: calc(@boxheight - @imgheight);
			background-color: #b7d7ff;
			color: #3b5fd2;
			font-size: 28rpx;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.del_btn {
			position: absolute;
			top: 5rpx;
			right: 5rpx;
			width: 50rpx;
			height: 50rpx;
			border-radius: 50%;
			z-index: 20;
		}
	}

	::v-deep .is-disabled {
		background-color: white !important;
		color: black;
	}
</style>